<?php
/**
 * @version     1.0.0
 * @package     com_geotrails
 * @copyright   Copyright (C) 2011. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      Verbier Technologies Sarl
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

$activityId = JRequest::getInt('activityId');
?>
<div class="com_geotrails_clear"></div>
<div id="com_geotrails_loading"></div>
<div id="com_geotrails_content">
<?php if (!strlen($this->params->get('view_type'))) { ?>
<?php echo $this->loadTemplate('default'); ?>
<?php } else { ?>
<?php echo $this->loadTemplate($this->params->get('view_type')); ?>
<?php } ?>
</div>
<input type="hidden" id="com_geotrails_activity_id" value="<?php echo $activityId; ?>">
<?php if ($this->params->get('show_map')) { ?>
<script type="text/javascript">
	hideAll();
	<?php foreach ($this->trails as $trail) { ?>
	<?php if (strlen($trail->lat) && strlen($trail->lng)) { ?>
	<?php $icon_path = JURI::root().'components/com_geotrails/assets/images/maps/activity_'.$trail->activity_id.'.png'; ?>
	<?php $html = GeoTrailsModelGeoTrails::setGoogleMapMarkerHtml($trail, 'fiche', $this->Itemid); ?>
	addMarker(new google.maps.LatLng("<?php echo $trail->lat; ?>","<?php echo $trail->lng; ?>"),"<?php echo $trail->title; ?>","<?php echo $html; ?>","activity_id_<?php echo $trail->activity_id; ?>","<?php echo $icon_path; ?>");
	<?php } ?>
	<?php } ?>
</script>
<?php } ?>
<?php if ($this->params->get('show_paginate')) { ?>
<script type="text/javascript">
	<?php if ($this->hide_paginate) { ?>
	document.getElementById("com_tourism_search_form_paginate").style.display = "none";
	<?php } else { ?>
	document.getElementById("com_tourism_search_form_paginate").style.display = "block";
	<?php } ?>
</script>
<?php } ?>